﻿using System;
using System.Reflection;

namespace Affinity.Flux
{
    /// <summary>
    /// Defines a child reference.
    /// </summary>
    public class ChildReferenceDefinition
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="member"></param>
        /// <param name="autoRegister"></param>
        public ChildReferenceDefinition(PropertyInfo member, bool autoRegister = true)
        {
            _Member = member;
            _AutoRegister = autoRegister;
        }

        /// <summary>
        /// Gets whether to automatically register new child components.
        /// </summary>
        public bool AutoRegister
        {
            get { return _AutoRegister; }
        }

        /// <summary>
        /// Gets a MemberInfo representing the child reference member.
        /// </summary>
        public PropertyInfo Member
        {
            get { return _Member; }
        }

        private bool _AutoRegister;
        private PropertyInfo _Member;
    }
}
